#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m);
    for(auto& x : a) cin >> x;
    for(auto& x : b) cin >> x;
    sort(a.begin(), a.end());
    sort(b.begin(), b.end(), greater<int>());
    ll tmp = 0, ans;
    for(int i = 0; i < n; i++) {
        tmp += (abs(a[i] - b[i]));
    }
    ans = tmp;
    for(int i = 0; i < n; i++) {
        tmp += abs(a[n - i - 1] - b[m - i - 1]) - abs(a[n - i - 1] - b[n - i - 1]);
        ans = max(ans, tmp);
    }
    cout << ans << endl;
}

int main() {
    int t;
    cin >> t;
    while(t--) solve();
    return 0;
}